package com.code.zjm;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

/**
 * Created by ZJM on 2017/6/30.
 */

public class SensorDetailActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sensor_info);

        Intent intent = getIntent();
        Bundle bundle = intent.getExtras();

        TextView sensorName = (TextView) findViewById(R.id.tv_sensor_name);
        TextView sensorType = (TextView) findViewById(R.id.tv_sensor_type);
        TextView sensorMaxRange = (TextView) findViewById(R.id.tv_sensor_max_range);
        TextView sensorMinDelay = (TextView) findViewById(R.id.tv_sensor_min_delay);
        TextView sensorPower = (TextView) findViewById(R.id.tv_sensor_power);
        TextView sensorResolution = (TextView) findViewById(R.id.tv_sensor_resolution);
        TextView sensorVendor = (TextView) findViewById(R.id.tv_sensor_vendor);
        TextView sensorVersion = (TextView) findViewById(R.id.tv_sensor_version);

        sensorName.setText(bundle.getString("Name"));
        sensorType.setText(bundle.getInt("Type") + "");
        sensorMaxRange.setText(bundle.getFloat("MaxRange") + "");
        sensorMinDelay.setText(bundle.getInt("MinDelay") + "");
        sensorPower.setText(bundle.getFloat("Power") + " mA");
        sensorResolution.setText((float)(Math.round(bundle.getFloat("Resolution")*10)/10)+"");
        sensorVendor.setText(bundle.getString("Vendor"));
        sensorVersion.setText(bundle.getInt("Version") + "");
    }
}
